<! Controller -->
<?php
	require_once ('../../models/Orders.php');
	require_once ('../../models/Users.php');
	session_start();
	$response = Orders::GetAll();
?>

<! View -->
<!DOCTYPE html>
<html lang="en">
	<?php include('../../inc/head.php'); ?>
	<body>
		<div>
			<?php include('../../inc/nav.php'); ?>

				
			<div id="content">
				<table class = "table table-bordered table-condensed table-hover table-striped">
					<tr>
						<th>Total</th><th>Tax</th><th>Shipping</th><th>Ship Name</th><th>Ship Address</th><th>Ship Address2</th><th>Ship City</th><th>Ship State</th><th>Ship Zip</th><th>Ship Phone</th>
						<th>Bill Name</th><th>Bill Address</th><th>Bill Address2</th><th>Bill City</th><th>Bill State</th><th>Bill Zip</th><th>Bill Phone</th>
						<th>Date</th><th>Payment Method</th><th>Card Number</th><th>Shipped</th><th>Tracking Number</th><th>User ID</th>
						<th>Actions</th>
					</tr>
					
					<?php while($row = $response->fetch_assoc()): ?>
						<tr>
							<td><?=$row['Total']?></td>
							<td><?=$row['Tax']?></td>
							<td><?=$row['Shipping']?></td>
							<td><?=$row['ShipName']?></td>
							<td><?=$row['ShipAddress']?></td>
							<td><?=$row['ShipAddress2']?></td>
							<td><?=$row['ShipCity']?></td>
							<td><?=$row['ShipState']?></td>
							<td><?=$row['ShipZip']?></td>
							<td><?=$row['ShipPhone']?></td>
							<td><?=$row['BillName']?></td>
							<td><?=$row['BillAddress']?></td>
							<td><?=$row['BillAddress2']?></td>
							<td><?=$row['BillCity']?></td>
							<td><?=$row['BillState']?></td>
							<td><?=$row['BillZip']?></td>
							<td><?=$row['BillPhone']?></td>
							<td><?=$row['Date']?></td>
							<td><?=$row['PaymentMethod']?></td>
							<td><?=$row['CardNumber']?></td>
							<td><?=$row['Shipped']?></td>
							<td><?=$row['TrackingNumber']?></td>
							<td><?=$row['User_id']?></td>
							<td>
								<a href="details.php?id=<?=$row['id']?>">Details</a>
								<a href="edit.php?id=<?=$row['id']?>">Edit</a>
								<a href="delete.php?id=<?=$row['id']?>">Delete</a>
							</td>				
						</tr>
					<?php endwhile; ?>
					
					<tr>
						<td><a href="create.php">Insert</a></td>
					</tr>
				
				</table>
			</div>
			<?php include('../../inc/footer.php'); ?>
		</div>
	</body>
</html>
